Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

London-class-8-Helena-Rog-JS-Week1#240

Closed
hachi-ops wants to merge 21 commits into
CodeYourFuture:masterfrom
hachi-ops:master
Closed

London-class-8-Helena-Rog-JS-Week1#240
hachi-ops wants to merge 21 commits into
CodeYourFuture:masterfrom
hachi-ops:master

Conversation

@hachi-ops
Copy link
Copy Markdown

Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in HOW_TO_MARK.md in the root of this repository

Your Details

  • Your Name: Helena Rog
  • Your City: London
  • Your Slack Name: Helena Rog

Homework Details

  • Module: JS
  • Week: 1

Notes

  • What did you find easy?

  • What did you find hard?

  • What do you still not understand?

  • Any other notes?

console.log("Hello world");
console.log("I've just started to learn JavaScript");
console.log(500);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good start. JavaScript can be challenging and with practice we will get better.

Comment thread exercises/C-variables/exercise.js Outdated
@@ -1,3 +1,7 @@
// Start by creating a variable `greeting`

var greeting = "Hello World!"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per CYF guidelines we should refrain from using var when declaring a variable and instead use let and const.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been guilty of this mistake all throughout my code:)

Copy link
Copy Markdown

@jstadnik jstadnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Only issue I've noticed is that you should try working on reusing functions.

Basically if I already have a function

function add(a, b) {
   return a + b;
}

And I want to create a function that returns string "The sum of 2 and 3 is 5" I would do this by writing

function printSum(a, b) {
     let sum = add(a, b);
     return `The sum of ${a} and ${b} is ${sum}`;
}

You can see I'm using the "add" function here, rather than write "a+b" again. This may seem silly for such basic examples, but it's the DRY (don't repeat yourself) rule that matters more once your functions do more complicated stuff.

The functions you write, can be used exactly like the built-in JavaScript functions (e.g. Math.round).

Comment thread exercises/F-strings-methods/exercise.js Outdated
// Start by creating a variable `message`
var myName = "Helen";
var myNameLength = myName.length;
var message = "Hello, my name is " + myName + "and my name is " + myNameLength + " characters long."
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a good place to use string interpolation, i.e

Suggested change
var message = "Hello, my name is " + myName + "and my name is " + myNameLength + " characters long."
var message = `Hello, my name is ${myName} and my name is ${myNameLength} characters long.`

function sum (num1, num2) {
return num1 + num2;
}
var sum = sum(13, 124);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation :)

var mentor3 = "Mimi";
var mentor4 = "Rob";
var mentor5 = "Yohannes";
var mentor1 = "Daniel";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's some indentation issues in the file -- basically, everything should start from the very left side, unless it's inside function brackets, or a for loop (you'll learn about these later) or something of this sort.


function helloGreeting(name) {
return name;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function doesn't do anything as is -- all the work is being done by the other function. As per instructions, you should have:

  • One function that returns the name in all caps
  • One function that prints "HELLO "
    Note, the second function should call your first function to achieve its goal. See how it's used for age in the example in the readme for this exercise.

}

var greeting = helloGreeting;
var shoutyGreeting = upperCaseGreeting;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just renaming the function -- is this what you intended to do?

I have left suggested CYF solutions commented out
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants